<template>
  <dt-modal-edit
    ref="edit"
    :title="title"
    :label-width="130"
    :width="500"
    @ok="onOk"></dt-modal-edit>
</template>

<script>
  import submitOpt from '../opt/submit.js'
  import initiateMgr from '@/biz/commission/initiate.js'

  export default {
    data() {
      return {
        info: {},
        title: '提交结算'
      }
    },
    mounted() {},
    methods: {
      show(info) {
        this.info = {
          ...info,
          digitalAttaches: null,
          remark: null
        }
        this.$refs.edit.show(submitOpt.options(this), this.info)
      },
      hide() {
        this.$refs.edit.hide()
      },
      onOk() {
        initiateMgr
          .submit({
            commissionId: this.info.commissionId,
            digitalAttaches: this.info.digitalAttaches,
            remark: this.info.remark
          })
          .then((res) => {
            this.$emit('success', res)
            this.hide()
          })
      }
    }
  }
</script>

<style></style>
